<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>实例4-3</title>
  </head>
  <body>
    <script>
      var data3 = {
        name: "taytay",
        sex: "woman",
        hobby: "program",
      };
      var d = JSON.stringify(data3);
      window.localStorage.setItem("data3", d);
      //将JSON字符串转换成为JSON对象输出
      var json = storage.getItem("data3");
      var jsonObj = JSON.parse(json);
      console.log(typeof jsonObj);
    </script>
  </body>
</html>
